package com.netease.pris.c;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import android.net.Uri;
import android.text.TextUtils;
import com.netease.b.a.d;
import com.netease.pris.atom.o;
import com.netease.pris.atom.u;
import com.netease.pris.provider.ac;
import com.netease.pris.provider.e;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class n
{
  static String[] a;
  public static final int b = 0;
  public static final int c = 1;
  public static final int d = 2;
  public static final int e = 3;
  private static String[] f;

  static
  {
    String[] arrayOfString1 = new String[4];
    arrayOfString1[0] = "_id";
    arrayOfString1[1] = "account";
    arrayOfString1[2] = "uid";
    arrayOfString1[3] = "other";
    a = arrayOfString1;
    String[] arrayOfString2 = new String[1];
    arrayOfString2[0] = "uid";
    f = arrayOfString2;
  }

  public static Cursor a(Context paramContext, String paramString1, String paramString2)
  {
    Cursor localCursor = null;
    if ((paramContext == null) || (TextUtils.isEmpty(paramString1)) || (paramString2 == null));
    while (true)
    {
      return localCursor;
      String str = "account = '" + paramString1 + "' AND " + "uid" + " in " + "(" + paramString2 + ")";
      localCursor = paramContext.getContentResolver().query(e.b, a, str, null, null);
    }
  }

  public static List a(Context paramContext, String paramString)
  {
    LinkedList localLinkedList = null;
    Cursor localCursor;
    if (paramContext != null)
    {
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = e.b;
      String[] arrayOfString1 = f;
      String[] arrayOfString2 = new String[1];
      arrayOfString2[0] = paramString;
      localCursor = localContentResolver.query(localUri, arrayOfString1, "account=?", arrayOfString2, null);
      if (localCursor == null);
    }
    try
    {
      if (localCursor.moveToFirst())
      {
        localLinkedList = new LinkedList();
        boolean bool;
        do
        {
          localLinkedList.add(localCursor.getString(0));
          bool = localCursor.moveToNext();
        }
        while (bool);
        return localLinkedList;
      }
      localCursor.close();
    }
    finally
    {
      localCursor.close();
    }
  }

  public static void a(Context paramContext, String paramString1, String paramString2, boolean paramBoolean)
  {
    if ((TextUtils.isEmpty(paramString1)) || (TextUtils.isEmpty(paramString2)));
    while (true)
    {
      return;
      if (paramBoolean)
      {
        ContentValues localContentValues = new ContentValues();
        localContentValues.put("account", paramString1);
        localContentValues.put("uid", paramString2);
        paramContext.getContentResolver().insert(e.b, localContentValues);
        continue;
      }
      String str = "account = '" + paramString1 + "' " + " AND " + "uid" + " = '" + paramString2 + "'";
      paramContext.getContentResolver().delete(e.b, str, null);
    }
  }

  public static void a(Context paramContext, String paramString, LinkedList paramLinkedList)
  {
    if ((TextUtils.isEmpty(paramString)) || (paramLinkedList == null) || (paramLinkedList.isEmpty()));
    while (true)
    {
      return;
      StringBuilder localStringBuilder = new StringBuilder();
      Iterator localIterator = paramLinkedList.iterator();
      while (localIterator.hasNext())
      {
        o localo = (o)localIterator.next();
        if (localo == null)
          continue;
        localStringBuilder.append("'").append(localo.a()).append("'").append(",");
      }
      if (localStringBuilder.length() > 0)
        localStringBuilder.deleteCharAt(-1 + localStringBuilder.length());
      c(paramContext, paramString, localStringBuilder.toString());
    }
  }

  public static void a(Context paramContext, String paramString, List paramList)
  {
    if ((paramContext != null) && (paramList != null) && (paramList.size() > 0))
    {
      List localList = a(d.h().a(), paramString);
      if ((localList != null) && (localList.size() > 0))
      {
        HashMap localHashMap = new HashMap();
        Iterator localIterator1 = paramList.iterator();
        while (localIterator1.hasNext())
        {
          u localu2 = (u)localIterator1.next();
          localHashMap.put(localu2.V(), localu2);
        }
        Iterator localIterator2 = localList.iterator();
        while (localIterator2.hasNext())
        {
          u localu1 = (u)localHashMap.get((String)localIterator2.next());
          if (localu1 == null)
            continue;
          localu1.b(true);
        }
      }
    }
  }

  public static void a(Context paramContext, ArrayList paramArrayList, String paramString)
  {
    if ((paramContext == null) || (paramArrayList == null) || (paramArrayList.size() == 0));
    while (true)
    {
      return;
      SQLiteDatabase localSQLiteDatabase = ac.a(paramContext).getWritableDatabase();
      localSQLiteDatabase.beginTransaction();
      SQLiteStatement localSQLiteStatement = null;
      try
      {
        StringBuilder localStringBuilder = new StringBuilder();
        localStringBuilder.append(" INSERT INTO ");
        localStringBuilder.append("offline");
        localStringBuilder.append("(");
        localStringBuilder.append("account");
        localStringBuilder.append(",");
        localStringBuilder.append("uid");
        localStringBuilder.append(")");
        localStringBuilder.append(" VALUES(");
        localStringBuilder.append("?,?");
        localStringBuilder.append(");");
        localSQLiteStatement = localSQLiteDatabase.compileStatement(localStringBuilder.toString());
        Iterator localIterator = paramArrayList.iterator();
        while (localIterator.hasNext())
        {
          String str = (String)localIterator.next();
          localSQLiteStatement.bindString(1, paramString);
          localSQLiteStatement.bindString(2, str);
          localSQLiteStatement.execute();
        }
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        if (localSQLiteStatement != null)
          localSQLiteStatement.close();
        localSQLiteDatabase.endTransaction();
        continue;
        localSQLiteDatabase.setTransactionSuccessful();
        if (localSQLiteStatement != null)
          localSQLiteStatement.close();
        localSQLiteDatabase.endTransaction();
        continue;
      }
      finally
      {
        if (localSQLiteStatement != null)
          localSQLiteStatement.close();
        localSQLiteDatabase.endTransaction();
      }
    }
    throw localObject;
  }

  public static int b(Context paramContext, String paramString)
  {
    int i;
    if ((paramContext == null) || (TextUtils.isEmpty(paramString)))
      i = 0;
    while (true)
    {
      return i;
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = e.b;
      String[] arrayOfString1 = a;
      String[] arrayOfString2 = new String[1];
      arrayOfString2[0] = paramString;
      Cursor localCursor = localContentResolver.query(localUri, arrayOfString1, "account=?", arrayOfString2, null);
      if ((localCursor == null) || (!localCursor.moveToFirst()))
      {
        if (localCursor != null)
          localCursor.close();
        i = 0;
        continue;
      }
      i = localCursor.getCount();
      localCursor.close();
    }
  }

  public static void b(Context paramContext, String paramString, LinkedList paramLinkedList)
  {
    if ((TextUtils.isEmpty(paramString)) || (paramLinkedList == null) || (paramLinkedList.isEmpty()));
    while (true)
    {
      return;
      StringBuilder localStringBuilder = new StringBuilder();
      Iterator localIterator = paramLinkedList.iterator();
      while (localIterator.hasNext())
      {
        u localu = (u)localIterator.next();
        if (localu == null)
          continue;
        localStringBuilder.append("'").append(localu.V()).append("'").append(",");
      }
      if (localStringBuilder.length() > 0)
        localStringBuilder.deleteCharAt(-1 + localStringBuilder.length());
      c(paramContext, paramString, localStringBuilder.toString());
    }
  }

  public static boolean b(Context paramContext, String paramString1, String paramString2)
  {
    int i;
    if ((paramContext == null) || (TextUtils.isEmpty(paramString1)) || (paramString2 == null))
      i = 0;
    while (true)
    {
      return i;
      String str = "account = '" + paramString1 + "' AND " + "uid" + " = '" + paramString2 + "'";
      Cursor localCursor = paramContext.getContentResolver().query(e.b, a, str, null, null);
      if ((localCursor == null) || (!localCursor.moveToFirst()))
      {
        if (localCursor != null)
          localCursor.close();
        i = 0;
        continue;
      }
      localCursor.close();
      i = 1;
    }
  }

  public static void c(Context paramContext, String paramString)
  {
    String str = "account = '" + paramString + "'";
    paramContext.getContentResolver().delete(e.b, str, null);
  }

  private static void c(Context paramContext, String paramString1, String paramString2)
  {
    if ((paramContext == null) || (TextUtils.isEmpty(paramString1)) || (paramString2 == null));
    while (true)
    {
      return;
      String str = "account = '" + paramString1 + "' AND " + "uid" + " in " + "(" + paramString2 + ")";
      paramContext.getContentResolver().delete(e.b, str, null);
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.c.n
 * JD-Core Version:    0.6.0
 */